<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>菜鸟教程(runoob.com)</title> 
<style>
p:first-line 
{
color:#ff0000;
font-variant:small-caps;
}
</style>
</head>
​
<body>
<p>你可以使用 "first-line" 伪元素向文本的首行设置特殊样式</p>

</body>
</html>



<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>菜鸟教程(runoob.com)</title> 
<style>
p:first-letter 
{
	color:#ff0000;
	font-size:xx-large;
}
</style>
</head>

<body>
<p>你可以使用 "first-letter" 伪元素向文本的首字母设置特殊样式：</p>
</body>
</html>